import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  plugins: [vue()],
  server: {
    port: 3000,
    proxy: {
      '/api': {
        target: 'http://localhost:8080',
        changeOrigin: true
      },
      '/ws': {
        target: 'http://localhost:8080',
        changeOrigin: true,
        ws: true
      }
    }
  },
  define: {
    global: 'globalThis'
  },
  resolve: {
    alias: {
      'global': 'globalThis'
    }
  },
  optimizeDeps: {
    include: ['sockjs-client', 'webstomp-client']
  },
  build: {
    rollupOptions: {
      output: {
        manualChunks: {
          vendor: ['vue', 'vue-router', 'pinia'],
          ui: ['element-plus', '@element-plus/icons-vue'],
          websocket: ['sockjs-client', 'webstomp-client']
        }
      }
    }
  }
}) 